package net.repchain.browser.controller;

import com.github.pagehelper.PageInfo;
import net.repchain.browser.common.WebPageInfo;
import net.repchain.browser.common.config.ResultVO;
import net.repchain.browser.entity.RepchainTransaction;
import net.repchain.browser.service.RepchainTransactionService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * (RepchainTransaction)表控制层
 *
 * @author lhc
 * @since 2023-11-21 14:26:45
 */
@RestController
@RequestMapping("repchainTransaction")
public class RepchainTransactionController {
    /**
     * 服务对象
     */
    @Resource
    private RepchainTransactionService repchainTransactionService;

    /**
     * 分页查询
     *
     * @param repchainTransaction 筛选条件
     * @param webPageInfo      分页对象
     * @return 查询结果
     */
    @GetMapping
    public ResultVO<PageInfo<RepchainTransaction>> queryByPage(RepchainTransaction repchainTransaction, WebPageInfo webPageInfo) {
        return ResultVO.getSuccess(this.repchainTransactionService.queryByPage(repchainTransaction, webPageInfo));
    }

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("{id}")
    public ResultVO<RepchainTransaction> queryById(@PathVariable("id") Long id) {
        return ResultVO.getSuccess(this.repchainTransactionService.queryById(id));
    }

}

